file(GLOB SRC *.cpp)

include_directories(${PROJECT_TOP_DIR}/libkperf/output/include)
link_directories(${PROJECT_TOP_DIR}/libkperf/output/lib)
add_executable(memtop ${SRC})
target_link_libraries(memtop ncurses kperf sym)
install(TARGETS memtop  DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
add_custom_command(TARGET memtop POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin
)
add_custom_command(TARGET memtop POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/src/memtop ${CMAKE_BINARY_DIR}/bin/
)   
add_custom_command(TARGET memtop POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_TOP_DIR}/libkperf/output/lib/*.so ${CMAKE_BINARY_DIR}/bin/
)